<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<title></title>
	<script src="js/jquery-2.1.0.js"></script>
	<script src="js/vue.js"></script>
	<script type="text/javascript">
		$(function () {
			function success(data, textStatus, jqXHR) {
				this.jsonResult = jqXHR.responseText;
				alert("成功");
			}

			function error(XMLHttpRequest, textStatus, errorThrown) {
				alert(errorThrown);
			}

			function executeAjax(options) {
				if (options.data && confirm("是否重置输入参数")) {
					this.inputData = JSON.stringify(options.data);
				} else {
					options.context = this;
					options.contentType = "application/json; charset=utf-8";
					options.success = success;
					options.error = error;
					if (options.data) {
						if(options.type === 'get'){
							options.data = JSON.parse(this.inputData);
						}
						else{
							options.data = this.inputData;
						}
					}
					options.url = "http://192.168.0.161:2268/" + options.url;
					//options.url = "https://park.weiwopark.com/api/"+options.url;
					$.ajax(options);
				}
			}
			var vue = new Vue({
				el: "#fun",
				data: {
					inputData: "",
					jsonResult: "",
					imgSrc: ""
				},
				methods: {
					//查询案件信息列表
					getCases: function () {
						executeAjax.call(this, {
							url: "DingCases",
							type: 'get',
							data: {
								startIndex: 0,
								takeCount: 20
							}
						});
					},
                    changePwd: function(){
                        executeAjax.call(this,{
                            headers:{
                                Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiIxODQ0NDEyODcxMDgyODE0Iiwic3lzdGVtX2lkIjoxLCJhY2Nlc3NUb2tlbiI6IjZlMzU1YTc5YTJjM2I0YTgiLCJhdXRob3JpdGllcyI6WyJVU0VSIl0sImNsaWVudF9pZCI6InNwYSIsImNlcnRpZmljYXRlX2lkIjoxLCJleHBpcmVzSW4iOiI2MDQ4MDAiLCJ1aWQiOjE4NDQ0MTI4NzEwODI4MTQsInNjb3BlIjpbImNvbW1vbiIsInJlZ3VsYXIiLCJtYW5hZ2VtZW50IiwiWkhZV0pHUFQiLCJRWUhZR0xQVCJdLCJzY29wZXMiOlsiY29tbW9uIiwicmVndWxhciIsIm1hbmFnZW1lbnQiXSwiZXhwIjoxNTcwODIzNDc3LCJ0b2tlblR5cGUiOiJiZWFyZXIiLCJqdGkiOiI0NjZjZDY4MC04MDAyLTQzOGQtODExZC0xOTRiYTA3YTVhZjciLCJyZWZyZXNoVG9rZW4iOiJmZjM3MjAyMTNmMjYzYWE4In0.iXV7oGEnKyeYFA52WAC4q8aygVMUoYPmoDENAp-3F70"
                            },
                            url: "Authorization/Index/ResetPwd",
                            type: 'put',
                            data:{
                                EncryMode: "0",
                                newPassword: "654321",
                                oldPassword: "123456",
                                reNewPassword: "654321"
                            }
                        });
                    }
				}
			});

		});
	</script>
</head>

<body>
	<div id="fun">
		<input type="button" value="查询案件信息列表" @click="getCases" />
		<input type="button" value="改密码" @click="changePwd" />
		<div style="margin: 5px;">输入：<br /><textarea style="width: 80%; height: 100px;" v-model="inputData"></textarea></div>
		<div style="margin: 5px;">输出：<br /><textarea style="width: 80%; height: 200px;">{{jsonResult}}</textarea></div>
	</div>

</body>

</html>